package com.tgy.mapper;

import com.tgy.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/***
 * @ClassName: UserMapper
 * @Description:
 * @Auther: 送一一块二向箔
 * @Date: 15:03 2021/12/14
 * @version : V1.0
 */
public interface UserMapper {
    @Select("select * from user")
    List<User> getUsers();

    //根据id查询用户
/*    @Select("select `id`, `name`,`pwd` as `password` from user where id = #{id} and name = #{name}")
    User selectUserById(@Param("id") int id,@Param("name") String name);*/

    //添加一个用户
    @Insert("insert into user (id,name,pwd) values (#{id},#{name},#{password})")
    int addUser(User user);

    //修改一个用户
    @Update("update user set name=#{name},pwd=#{pwd} where id = #{id}")
    int updateUser(User user);

}
